package com.nerve.secondhandcar.dao;

import java.util.List;

import org.apache.commons.lang3.StringUtils;
import org.ko.core.dao.hibernate4.BaseTypedDao;
import org.ko.core.dao.support.Finder;
import org.ko.core.domain.auth.User;

import org.springframework.stereotype.Repository;
import com.nerve.secondhandcar.domain.Evaluators;


/**
 * 平台中的测试师对象DAO层
 * @author 集成显卡
 * @version 2014-10-14 15:29:15
 */
 @Repository
public class EvaluatorsDao  extends BaseTypedDao<Evaluators, Long>{

	@Override
	protected Class<Evaluators> getEntityClass() {
		return Evaluators.class;
	}
	
	@SuppressWarnings("unchecked")
	public List<Evaluators> findForSelect(int pageNo, int pageSize, String keyword) {
		String hql = "FROM Evaluators where id>"+pageNo;
		Finder finder = Finder.create(hql);
		
		if(StringUtils.isNotBlank(keyword)){
			finder.append(" and (name like :kw or mobilephone like :kw or email like :kw)");
			finder.setParam("kw", "%"+keyword+"%");
		}
		finder.setMaxResults(pageSize);
		return find(finder);
	}
}